package cn.it62.pojo;

/**
 * @author zhenhuaShen
 * @version 1.0
 * @date 2019/7/30
 * @description cn.it62.pojo
 */
public class Dog extends Pet {
    private String strain;

    public Dog() {

    }

    public Dog(String nickName, String gender, int age, int love, int health, String strain) {
        //super(nickName, gender, age, love, health);
        this.strain = strain;
    }

    public String getStrain() {
        return strain;
    }

    public void setStrain(String strain) {
        this.strain = strain;
    }


    @Override
    public String toString() {
        super.setNum();
        return "Dog{" +
                "nickName='" + getNickName() + '\'' +
                ", gender='" + getGender() + '\'' +
                ", strain='" + strain + '\'' +
                ", age=" + getAge() +
                ", health=" + getHealth() +
                '}';
    }

    /**
     * 吃食物
     *
     * @param food
     */
    @Override
    public void eat(String food) {
        System.out.println("名字叫" + getNickName() + "的狗狗在吃" + food);
        if (getHealth() < 100) {
            int health = getHealth();
            health++;
            setHealth(health);
        }
    }

    ;

    /**
     * 玩耍
     */
    @Override
    public void play() {
        if (getHealth() > 1) {
            System.out.println("名字叫" + getNickName() + "的狗狗在玩耍");
            int health = getHealth();
            health--;
            setHealth(health);
            if (getLove() < 100) {
                int love = getLove();
                love++;
                setLove(love);

            }
        } else {
            System.out.println("狗狗没力气了，需要休息补充食物！");
        }
    }
}





























































